<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>

<%@ page import="javax.servlet.ServletContext" %>
<%@ page import="javax.servlet.jsp.tagext.TagSupport"%>
<%@ page import="com.ba360.portal.database.dbo.User" %>
<%@ page import="com.ba360.portal.util.Helper" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

		<style type="text/css">
		<!--
			.style1 {color: #FFFFFF}
		-->
		</style>
		<style type="text/css">
		<!--
			.style3 {color: #2399b3}
			.style4 {color: #FE7503}
		-->
		</style>
		<script>
			function doComplaint() 
			{
			
				var url = "../portal/complaint.do";
				window.location.href = url;
			}
			function navigate(buton)
			{	
				<%String adId = request.getParameter("advId");%>
				var j = <%=adId%>;					
				if(buton == "first")
				{
					var res = j+1;
					window.location.href="http://www.droik.com/portal/postadv.do?advId="+res+"&action=DisplayAd";
				}
				else if(buton == "next")
				{
					var res = j-1;
					window.location.href="http://www.droik.com/portal/postadv.do?advId="+res+"&action=DisplayAd";
				}				
			}
			function goBack() {
			
				var url = "../jsp/DisplayAd.jsp?PostingType=" + "<%=session.getAttribute("PostingType")%>";
				<%
					if(null!=session.getAttribute("CatType")) 
					{
				%>
						url = url + "&CatType=" + "<%=session.getAttribute("CatType")%>";
				<%
					}
				%>
				<%
					if(!"".equals(session.getAttribute("pricemin"))) 
					{
				%>
						url = url + "&pricemin=" + "<%=session.getAttribute("pricemin")%>";
				<%
					}
				%>
				<%
					if(!"".equals(session.getAttribute("pricemax"))) 
					{
				%>
						url = url + "&pricemax=" + "<%=session.getAttribute("pricemax")%>";
				<%
					}
				%>
				<%
					if(!"".equals(session.getAttribute("excludeSearchContent"))) 
					{
				%>
						url = url + "&excludeSearchContent=" + "<%=session.getAttribute("excludeSearchContent")%>";
				<%
					}
				%>
				<%
					if(!"".equals(session.getAttribute("adContent"))) 
					{
				%>	
						url = url + "&adContent=" + "<%=session.getAttribute("adContent")%>";
				<%
					}
				%>
				<%
					if(null!=session.getAttribute("City")) 
					{
				%>
						url = url + "&City=" + "<%=session.getAttribute("City")%>";
				<%
					}
				%>
				<%
					if(null!=session.getAttribute("City")) 
					{
				%>
						url = url + "&City=" + "<%=session.getAttribute("City")%>";
				<%
					}
				%>
				<%
					if(null!=session.getAttribute("listPict")) 
					{
				%>
						url = url + "&listPict=" + "<%=session.getAttribute("listPict")%>";			
				<%
					}
				%>	
				window.location.href = url;
			}
			</script>
			<%
				String  initPict1 = null;
				String  initPict2 = null;
				String  initPict3 = null;
				String  initPict4 = null;
				String  initPict5 = null;
				String  initPict6 = null;
			
				String  comment1 = "";
				String  comment2 = "";
				String  comment3 = "";
				String  comment4 = "";
				String  comment5 = "";
				String  comment6 = "";
			
				String advId = request.getParameter("advId");
			
				Helper help = new Helper();
				// Get the path to the /Users/images from the servlet context.
				ServletContext theApplicationsServletContext =
					 (ServletContext) session.getServletContext();
			
				int memId = help.getUserId(advId);
			
				String realPath = theApplicationsServletContext
				.getRealPath("/droik/Users/images/" + memId);
			
				if(advId!=null && advId.length()>0) {
			
					initPict1 = help.getOrgPath(realPath, advId, 1);
					initPict2 = help.getOrgPath(realPath, advId, 2);
					initPict3 = help.getOrgPath(realPath, advId, 3);
					initPict4 = help.getOrgPath(realPath, advId, 4);
					initPict5 = help.getOrgPath(realPath, advId, 5);
					initPict6 = help.getOrgPath(realPath, advId, 6);
			
					comment1 = help.getComment(1, advId);
					comment2 = help.getComment(2, advId);
					comment3 = help.getComment(3, advId);
					comment4 = help.getComment(4, advId);
					comment5 = help.getComment(5, advId);
					comment6 = help.getComment(6, advId);
				}
			
				if(advId==null) advId = "";
				// int hits = help.updateHits(advId); Modified by Arun on 25-AUG-2009
				int hits = 1;
				help.Finalize();
			%>
			
	</head>
	<body>
		<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  			<tr>
    				<td>
    					<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      						<tr>
        						<td>
        							<jsp:include page="/jsp/top.jsp"/>
        						</td>
      						</tr>
      					
      						<tr>
        						<td height="232" valign="top" bgcolor="#FFFFFF">
        							<table width="100%"  border="0" cellspacing="0" cellpadding="0">
          								<tr>
            									<td width="77%" valign="top">
            										<table width="97%"  border="0" align="center" cellpadding="0" cellspacing="0">
              											<tr>
                											<td colspan="2" class="text style3"><img src="../images/spacer.gif" width="1" height="10"></td>
                										</tr>
              											<tr>
                											<td width="91%" height="25" class="text style3">
                												<span>
                													<a class="blu" href="../portal/SearchAdv.do?action=SearchAd&PostingType=<bean:write name="NewAdRecord" property="category_id"/>" style="text-decoration:none"><bean:write name="NewAdRecord" property="catName"/></a>
                												</span> 
                												&nbsp;<img src="../images/ar.jpg" width="6" height="9">&nbsp;
                												<span>
                													<a class="orng" href="../portal/SearchAdv.do?action=SearchAd&CatType=<bean:write name="NewAdRecord" property="sub_cat_id"/>" style="text-decoration:none"><bean:write name="NewAdRecord" property="subCatName"/></a>
                												</span>
                											</td>
                											<td width="20%" class="text style3">
                												<a onclick="navigate('first')"><img src="../images/prev.gif" alt="first" width="27" height="26" style="cursor:pointer"></a>
                												<a onclick="navigate('next')"><img src="../images/next.gif" alt="next" width="27" height="26" style="cursor:pointer"></a>                												
                											</td>
              											</tr>
														<tr>
											                <td class="text" colspan="2"><div align="center"><img height="3" width="725" vspace="5" src="../images/line.jpg"/></div></td>
											              </tr>        
	              											<tr>     											
	          												<td colspan="2" class="bluehead">
              													<bean:write name="NewAdRecord" property="title"/>
              												</td>
              											</tr>
              											<tr>
                											<td colspan="2" class="text">
                												<table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  													<tr class="smallorng">
                    														<td height="20" width="50%">Posting Date : <bean:write name="NewAdRecord" property="datePosted"/></td>
                    														<td>Price : &nbsp;<bean:write name="NewAdRecord" property="price"/></td>
                    														<td><div align="right">Visits - <%=hits%></div></td>
                  													</tr>
                												</table>
                											</td>
              											</tr>              											
              											<tr>
												                <td class="text" colspan="2"><div align="center"><img height="3" width="725" vspace="5" src="../images/line.jpg"/></div></td>
												              </tr>
              											<tr>
                											<td colspan="2" class="text">                																										
 														<!--table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
															<tr>
																<td colspan="5"-->															              			              
																      <table border="0" cellpadding="3" cellspacing="0" width="95%" align="center" >
																		<tr>
																			<td>																			
																			<%
																			if (request.getParameter("action1")!=null) 
																			{
																		%>
																		<%
																				com.ba360.portal.database.dbo.User user = (com.ba360.portal.database.dbo.User)session.getAttribute("USER");
																				if (user==null)
																				{
																				request.setAttribute("USER_NOT_LOGGED_IN","UNPLUGGED");
																		%>								
																				<jsp:forward page="/portal/login.do"/>								
																		<%
																				}	
																		%>
																				<%int userId=(int)((com.ba360.portal.database.dbo.User)session.getAttribute("USER")).getUserId();%>								
																				<logic:notEqual name="NewAdRecord" property="memberId" value="<%=userId+""%>">
																				<jsp:forward page="../jsp/Error.jsp"/>
																				</logic:notEqual>
																				<span class="error"> Are you sure you want to delete this ad?</span>
																		<%	}%>
																			</td>
																		</tr>																																																							              																																			
																	</table>
																	<table width="95%" border="0" cellpadding="4" cellspacing="0" align="center">																														
																		<tr>
																			<td valign="top" height="24" class="text" style="WORD-BREAK:BREAK-ALL"> 																																								
																				<bean:write name="NewAdRecord" property="postDesc" filter="false"/>																				
																			</td>
																			<td width="1%">
																			</td>
																		</tr>																																				
																		<tr height=10>
																		</tr>
																		
																		<tr>
																			<td valign="top" height="28" colspan="3" class="text" >
																				<logic:equal name="NewAdRecord" property="isAnonymize" value="off"><font size="-1" class="boldtext"><span class="label">Email</span>:<a href="mailto:<bean:write name="NewAdRecord" property="contactEmail"/>">
																				<bean:write name="NewAdRecord" property="contactEmail"/></a></font></logic:equal>
																			</td>
																		</tr>
																			<logic:notEmpty name="NewAdRecord" property="contactNumber">
																		<tr>
																			<td valign="top" height="24" colspan="3" class="text" ><font size="-1"><span class="boldtext">Phone
																			Number:&nbsp; </span><bean:write name="NewAdRecord" property="contactNumber"/></font>
																			</td>
																		</tr>
											
																			  </logic:notEmpty>
																			  <logic:equal name="catType" scope="request" value="housing">
																		<tr>
																			<td  valign="top" class="text" colspan="3" ><logic:notEmpty name="NewAdRecord" property="squareFeet">
																				<span class="boldtext">SqFt:&nbsp;</span> <bean:write name="NewAdRecord" property="squareFeet"></bean:write></logic:notEmpty>
																				<br>
																				<span class="boldtext">No of Bedrooms:&nbsp;</span> <bean:write name="NewAdRecord" property="houseType"/>
																			</td>
																		</tr>
														  						</logic:equal>
																		<tr>
																			<td  colspan="3">
																				<table style="table-layout: fixed;">
																					<tr>
																					   <% if(initPict1!=null && initPict1.length()>0) 
																					      { %>
																						<td>
																							<table>
																								<tr>
																									<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict1%>" align=absBottom border=0 name="pict1"></td>
																								</tr>
																								<tr>
																									<td align="center" class="boldtext"><%=comment1%></td>
																								</tr>
																							</table>
																						</td>
																					  <% }
																					     if(initPict2!=null && initPict2.length()>0) 
																					     { %>
																						<td>
																							<table>
																								<tr>
																									<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict2%>" align=absBottom border=0 name="pict2"></td>
																								</tr>
																								<tr>
																									<td align="center" class="boldtext"><%=comment2%></td>
																								</tr>
																							</table>
																						</td>
																					  <% } %>
																					</tr>
																					
																					<tr>
																					<%  if(initPict3!=null && initPict3.length()>0) 
																					    { %>
																						<td>
																							<table>
																								<tr>
																									<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict3%>" align=absBottom border=0 name="pict3"></td>
																								</tr>
																								<tr>
																									<td align="center" class="boldtext"><%=comment3%></td>
																								</tr>
																							</table>
																						</td>
																					<% }
																					   if(initPict4!=null && initPict4.length()>0) 
																					   { %>
																						<td>
																							<table>
																								<tr>
																									<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict4%>" align=absBottom border=0 name="pict4"></td>
																								</tr>
																								<tr>
																									<td align="center" class="boldtext"><%=comment4%></td>
																								</tr>
																							</table>
																						</td>
																					<% } %>
																	  				</tr>
																	  				<tr>
																					<% if(initPict5!=null && initPict5.length()>0) 
																					   { %>
																						<td>
																							<table>
																								<tr>
																									<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict5%>" align=absBottom border=0 name="pict5"></td>
																								</tr>
																								<tr>
																									<td align="center" class="boldtext"><%=comment5%></td>
																								</tr>
																							</table>
																						</td>
																					<% }
																					   if(initPict6!=null && initPict6.length()>0) 
																					   { %>
																						<td>
																							<table>
																								<tr>
																									<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict6%>" align=absBottom border=0 name="pict6"></td>
																								</tr>
																								<tr>
																									<td align="center" class="boldtext"><%=comment6%></td>
																								</tr>
																							</table>
																						</td>
																					<% } %>
																	 				 </tr>
																	 			</table>
																			</td>
																		</tr>
																		
																														
																															
																		<tr>
																			<td colspan="3" class="text" valign="top" align="left" >
																				<%String action1 = request.getParameter("action1");
																				if (action1!=null && action1.equals("DeleteAdv"))
																					{%>
																					<form name="form1" method="post" action="../portal/postadv.do">
																						<div align="right">
																							<input type="hidden" name="advId" value="<%=advId%>"/>
																							<input type="hidden" name="action" value="DeleteAd"/>
																							<input type="submit" name="Submit" value="Delete" class="button">
																							<input type="submit" name="Submit" value="Cancel" class="button">
																							</div>
																					</form>
																					<%}else{%>
																					<form method="post" action="../portal/response.do">
																						<table align="center">
																							<tr>																						
																								<td><img src="../images/back.jpg" style="cursor:pointer" onClick="javascript:goBack()"/></td>
																								<td><input type="image" src="../images/resp.jpg" name="Response" value="Respond"/></td>
																								<td><img src="../images/comp.jpg" style="cursor:pointer" name="Complaint" onClick="javascript:doComplaint()" onMouseOver="javascript:this.title='Report to Admin in case you have any issues with this posting'" /></td>
																							</tr>
																						</table>																						
																					</form>
																				<%}%>
																			</td>
																		</tr>
											            					</table>											            					
											            				<!--/td>
											         	 		</tr>
														</table-->
               												</td>
              											</tr>              											
            										</table>
            									</td>
            									<td width="23%" valign="top">
<script type="text/javascript"><!--
google_ad_client = "pub-1416697553350221";
/* 160x600, created 3/13/09 */
google_ad_slot = "0848652499";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
          								</tr>
        							</table>
        						</td>
      						</tr>
      						<tr>
        						<td>
	        			<jsp:include page="/jsp/footer.html"/>			
	          					
          						</td>
      						</tr>
    					</table>
    				</td>
  			</tr>
		</table>
	
	</body>
</html>
